<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <script>
        // console.log(this);
        // for (let index = 0; index < 5; index++) {
        //     console.log(this);
        // }

        // function aa() {
        //     console.log(this);
        // }
        // aa();
        var name = "小丽";
        var obj = {
            name: "小明",

            say: () => {
                console.log(this.name);
            },
        };
        obj.say();

        var num = 10;

        function aa() {
            console.log(num);
        }
        aa();
        // aa没有num可以用上一层的num 箭头函数没有this 能够使用上一层的this
    </script>
</body>

</html>